package com.seven.service;

import java.util.List;

import com.seven.dao.AWorkerDao;
import com.seven.entity.Worker;

//员工业务类
public class AWorkerService {

	AWorkerDao workerDao = new AWorkerDao();
	
	/**
	 * 员工的增加
	 */
	public int addWorker(Worker worker) {
		return workerDao.addWorker(worker);
	}
	
	/**
	 * 员工的修改(对密码和工分)
	 */
	public int updateWorker(Worker worker) {
		return workerDao.updateWorker(worker);
		
	}
	
	/**
	 * 员工的删除
	 */
	public int deleteWorker(Worker worker) {
		return workerDao.deleteWorker(worker);
		
	}
	
	/**
	 * 员工的查询(查询所有)
	 */
	public List<Worker> selectAllWorker() {
		return workerDao.selectAllWorker();
		
	}
	
	/**
	 * 员工的查询(通过id)
	 */
	public List<Worker> selectByWorker_id(Worker worker) {
		return workerDao.selectByWorker_id(worker);
		
	}
	
	/**
	 * 员工的查询(通过姓名)
	 */
	public List<Worker> selectByWorker_name(Worker worker) {
		return workerDao.selectByWorker_name(worker);
		
	}

	/**
	 * 员工的查询(通过账号)
	 */
	public Worker selectByWorker_username(Worker worker) {
		List<Worker> workers = workerDao.selectByWorker_username(worker);
		if (workers!=null && workers.size()!=0){
			return workers.get(0);
		}
		return null;
		
	}

	


	/**
	 * 员工的查询(通过工作状态=空闲)
	 */
	public List<Worker> selectByWorker_state0() {
		return workerDao.selectByWorker_state0();
		
	}
	
	/**
	 * 员工的查询(通过工作状态=忙碌)
	 */
	public List<Worker> selectByWorker_state1() {
		return workerDao.selectByWorker_state1();
		
	}
}
